import {UserActions} from './user';

const initialState = {};

export const TokenActions = {
  TOKEN_UPDATE: 'token_update',
};

export function updateToken(payload) {
  return {
    type: TokenActions.TOKEN_UPDATE,
    payload,
  };
}

export default function token(state = initialState, action) {
  switch (action.type) {
    case TokenActions.TOKEN_UPDATE:
      return {...state, ...action.payload};
    case UserActions.USER_SIGN_OUT:
      return initialState;
    default:
      return state;
  }
}
